import 'package:flutter/cupertino.dart';
import 'package:frametrim/utility/screen.dart';

/**
 * 渐变色
 * 线性渐变
 * 从上到下
 */
class GradientView extends StatelessWidget {
  //渐变色容器
  late List<Color> colors;

  //宽高
  late double? mWidth;
  late double? mHeigth;

  GradientView({required this.colors, this.mWidth, this.mHeigth});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: mWidth ?? Screen.width,
      height: mHeigth ?? Screen.height,
      decoration: BoxDecoration(
        gradient: LinearGradient(
          //渐变色
          colors: colors,
          //渐变位置
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter
        ),
      ),
    );
  }
}
